package com.sxj.shop.rowmapper;

import com.sxj.shop.entity.Order;
import com.sxj.shop.entity.User;
import com.sxj.shop.util.RowMapper;

import java.sql.ResultSet;

/**
 * @author 石小俊
 * @date 2023年12月2023/12/19日 18:04
 */
public class OrderRowMapper implements RowMapper {
    @Override
    public Object mapRow(ResultSet rs) throws Exception {
        Order order = new Order();
        order.setId(rs.getInt("id"));
        order.setNo(rs.getString("no"));
        order.setPrice(rs.getDouble("price"));
        User user = new User();
        user.setId(rs.getInt("user_id"));
        order.setUser(user);
        return order;
    }
}
